package book_management.user;

import book_management.operation.IOperation;
import book_management.operation.ipml.*;

import java.util.Scanner;

public class AdminUser extends User {

    private Scanner scanner = new Scanner(System.in);

    public AdminUser(String name) {
        this.name = name;
        this.operations = new IOperation[]{//这还是个数组宝儿，写分号干嘛

                new AddOperation(),

                new RemoveOperation(),

                new UpdateOperation(),

                new FindOperation(),

                new DisplayAllBooks()
        };

    }

    @Override
    public int menu() {
        System.out.println("==========================");
        System.out.println("欢迎" + name + "来这玩儿！！！");
        System.out.println("1.添加书籍");
        System.out.println("2.删除书籍");
        System.out.println("3.更新书籍");
        System.out.println("4.查询书籍");
        System.out.println("5.查看当前书籍列表");
        System.out.println("-1.退出系统");
        System.out.println("选一下把，宝儿~");
        int choice = scanner.nextInt();
        if (choice == -1) {
            scanner.close();
        }
        System.out.println("==========================");
        return choice;
    }
}
